home *** CD-ROM | disk | FTP | other *** search
/ Hack-Mag 1 / Hack-Mag - Issue 1 (1990-08-22)(D-Tect)(PD).adf / Soundtracker-Replays / mtp08c.S next >
Text File  |  2014-06-19  |  13KB  |  660 lines

  1. ;1990-05-29
  2. ; 01    data labels changed to offsets, (pc) accesses to (a4) changed
  3. ; 02    mt_data lea's to move.l mt_song(a4) changed
  4. ; 03+    all absolute data access changed to (a4)
  5. ; 04+    all branches extended to either .s or .L, MasterSeka opt O used
  6. ; 05+    illegal clr and .b access to hardware regs replaced
  7. ; 06+    some severe cases optimized
  8. ;1990-05-30
  9. ; 07+    data table initialized, stupid setfilt repaired
  10. ; 08+    interrupt wait inserted, shit twice wait repaired
  11.  
  12.  
  13. ; @ includes colortest speed monitor marked @
  14.  
  15. ; ONLY FOR EXAMPLEPLAYER!!!
  16. songabs = $90000
  17.  
  18. start:    lea    mt_initdata(pc),a4    ; this region may be obtained
  19.                     ;  via ALLOCMEM
  20.     move.l    #songabs,mt_song(a4)    ; set module address
  21.     bsr.s    timerinit
  22.     bsr.L    mt_init
  23.  
  24. loop:
  25.     cmpi.b    #200,$dff006
  26.     bne.s    loop
  27.     move.w    #$000f,$dff180        ; @ color
  28.     bsr.L    mt_music
  29.     move.w    #0,$dff180        ; @ color
  30. lolo:    cmpi.b    #201,$dff006
  31.     blo.s    lolo
  32.     btst    #7,$bfe001
  33.     bne.s    nores
  34.     bsr.L    mt_init
  35. nores:    btst    #6,$bfe001
  36.     bne.s    loop
  37.     bsr.L    mt_end
  38.     bsr.L    timerexit
  39.     rts
  40.  
  41.  
  42.  
  43.  
  44. skip = 8                ; # lines delay for DMAoff
  45.  
  46. ;------------   Init timerA of CIAB (l6int) AMICOM 1988-01-26
  47. ; this routine does NOT work along with high-level AmigaDOS
  48. ;  applications. (Use cia.resource instead)
  49.  
  50. timerinit:                
  51.     movem.l    d1/a0-a1,-(a7)        ;
  52.     lea    timer_iv_data(pc),a1    ; maybe you'll find a better
  53.     move.l    a4,(a1)            ;  solution (ex: use addr 0!)
  54.     lea    timeroldIena(pc),a1    ;
  55.     move.w    $dff01c,(a1)+        ;
  56.     move.b    $bfde00,(a1)+        ; save old cr
  57.  
  58. ; find divide value of cia timer 1989-08-19 by AMICOM
  59.  
  60.     and.b    #$fe,$bfde00        ; stop timerA  CIAB
  61.     bsr.s    timeriwait        ; delay for slow cia...
  62.     bset    #4,$bfde00        ; force load
  63.     bsr.s    timeriwait        ; delay for slow cia...
  64.     move.b    $bfd500,(a1)+        ; get high
  65.     move.b    $bfd400,(a1)+        ; low byte
  66.  
  67.     move.b    #$01,$bfdd00        ; disable ciab timerA int
  68.     lea    timerl6handler(pc),a0    ;
  69.     lea    timeroldl6int(pc),a1    ;
  70.     move.l    $78.w,(a1)        ;
  71.     tst.b    $bfdd00            ; clr all requests
  72.     move.w    #$2000,$dff09c        ;
  73.     move.l    a0,$78.w        ;
  74.                     
  75.     move.w    #skip*455/10,d1        ; 227.5 cycles/line div by 5
  76.     and.b    #$c0,$bfde00        ; ciab timerA init
  77.     or.b    #$08,$bfde00        ; one shot mode
  78.     move.b    d1,$bfd400        ; low byte
  79.     lsr.w    #8,d1            ;
  80.     move.b    d1,$bfd500        ; high byte (starts timer!)
  81.     and.b    #$fe,$bfde00        ; stop it!
  82.     move.b    #$81,$bfdd00        ; allow timerA int
  83.     move.w    #$a000,$dff09a        ; allow l6 (ciab) int
  84.     movem.l    (a7)+,d1/a0-a1        ;
  85. timeriwait:                
  86.     rts                ;
  87.                     
  88.                     
  89. timerexit:                
  90.     movem.l    d0/a0,-(a7)        ;
  91.     move.w    #$2000,$dff09a        ; disable l6/ciab int
  92.     move.b    #$01,$bfdd00        ; disable ciab timerA int
  93.     and.b    #$fe,$bfde00        ; stop timera 
  94.     tst.b    $bfdd00            ; clr all requests
  95.     move.w    #$2000,$dff09c        ;
  96.     move.l    timeroldl6int(pc),$78.w    ; restore
  97.     lea    timeroldcr(pc),a0    ;
  98.     move.b    2(a0),$bfd400        ; restore old counter
  99.     move.b    1(a0),$bfd500        ; starts timer
  100.     and.b    #$fe,$bfde00        ; stop it!
  101.     move.b    (a0),d0            ;
  102.     and.b    #$0f,d0            ; only timerA bits
  103.     or.b    d0,$bfde00        ; restore cont reg
  104.     move.w    timeroldIena(pc),d0    ;
  105.     and.w    #$2000,d0        ; mask l6 status
  106.     lsl.w    #2,d0            ; to set/clr
  107.     or.w    #$2000,d0        ; only this one
  108.     move.w    d0,$dff09a        ; set/clr
  109.     move.b    #$81,$bfdd00        ; allow int on cia
  110.     movem.l    (a7)+,d0/a0        ;
  111.     rts                ;
  112.                     
  113. timer_iv_data:  dc.l    0       ; base for routine
  114. timeroldl6int:    dc.l    0    ; old l6 auto-vector
  115. timeroldIena:    dc.w    0    ; old status of INTENA
  116. timeroldcr:    dc.b    0    ; old status of contr reg
  117. timerolddiv:    dc.b    0,0    ; old divide counter value
  118. even
  119.  
  120.  
  121. ***********************************************************************
  122. ***   Mega fast playroutine for the Spreadpoint SoundTracker V2.5   ***
  123. ***                                                                 ***
  124. ***  Based on the playroutine by Mahoney & Kaktus, Hallonsoft 1989  ***
  125. ***  Tidied-up, de-lamed, sped up and changed to interrupt wait     ***
  126. ***                             by                                  ***
  127. ***            A M I C O M  of  SPREADPOINT in May 1990             ***
  128. ***********************************************************************
  129.  
  130.  
  131. mt_init:
  132.     movem.l    d0-d7/a0-a6,-(a7)
  133.     moveq    #mt_enddata/4-3,d0
  134.     lea    8(a4),a0
  135.  
  136. mt_i_2:
  137.     clr.l    (a0)+
  138.     dbf    d0,mt_i_2
  139.     move.w    #$0001,20+mt_voice1(a4)
  140.     move.w    #$0002,20+mt_voice2(a4)
  141.     move.w    #$0004,20+mt_voice3(a4)
  142.     move.w    #$0008,20+mt_voice4(a4)
  143.     move.l    mt_song(a4),a0
  144.     move.l    a0,a1
  145.     add.l    #$3b8,a1
  146.     moveq    #$7f,d0
  147.     moveq    #0,d1
  148. mt_loop:move.l    d1,d2
  149.     subq.w    #1,d0
  150. mt_lop2:move.b    (a1)+,d1
  151.     cmp.b    d2,d1
  152.     bgt.s    mt_loop
  153.     dbf    d0,mt_lop2
  154.     addq.b    #1,d2
  155.  
  156.     lea    mt_samplestarts(a4),a1
  157.     asl.l    #8,d2
  158.     asl.l    #2,d2
  159.     add.l    #$43c,d2
  160.     add.l    a0,d2
  161.     move.l    d2,a2
  162.     moveq    #$1e,d0
  163. mt_lop3:clr.l    (a2)
  164.     move.l    a2,(a1)+
  165.     moveq    #0,d1
  166.     move.w    42(a0),d1
  167.     add.l    d1,d1
  168.     add.l    d1,a2
  169.     add.l    #$1e,a0
  170.     dbf    d0,mt_lop3
  171.  
  172. ;    or.b    #$2,$bfe001        ; nonsense
  173.     move.b    #$6,mt_speed(a4)
  174.     moveq    #0,d0
  175.     move.w    d0,$dff0a8        ; was clr
  176.     move.w    d0,$dff0b8
  177.     move.w    d0,$dff0c8
  178.     move.w    d0,$dff0d8
  179.     clr.b    mt_songpos(a4)
  180.     clr.b    mt_counter(a4)
  181.     clr.w    mt_pattpos(a4)
  182.     movem.l    (a7)+,d0-d7/a0-a6
  183.     rts
  184.  
  185. mt_end:    
  186.     move.l    d0,-(a7)
  187.     moveq    #0,d0
  188.     move.w    d0,$dff0a8        ; was clr
  189.     move.w    d0,$dff0b8
  190.     move.w    d0,$dff0c8
  191.     move.w    d0,$dff0d8
  192.     move.w    #$000f,$dff096
  193.     move.l    (a7)+,d0
  194.     rts
  195.  
  196. mt_music:
  197.     movem.l    d0-d4/a0-a3/a5-a6,-(a7)
  198.     bsr.s    mt_music_2
  199.     movem.l    (a7)+,d0-d4/a0-a3/a5-a6
  200.     rts
  201.  
  202. mt_music_2:
  203.     move.l    mt_song(a4),a0
  204.     addq.b    #$1,mt_counter(a4)
  205.     move.b    mt_counter(a4),D0
  206.     cmp.b    mt_speed(a4),D0
  207.     blt.s    mt_nonew
  208.     clr.b    mt_counter(a4)
  209.     bra.L    mt_getnew
  210.  
  211. mt_nonew:
  212.     lea    mt_voice1(a4),a6
  213.     lea    $dff0a0,a5
  214.     bsr.L    mt_checkcom
  215.     lea    mt_voice2(a4),a6
  216.     add.w    #$10,a5            ; next audio ch
  217.     bsr.L    mt_checkcom
  218.     lea    mt_voice3(a4),a6
  219.     add.w    #$10,a5            ; next audio ch
  220.     bsr.L    mt_checkcom
  221.     lea    mt_voice4(a4),a6
  222.     add.w    #$10,a5            ; next audio ch
  223.     bsr.L    mt_checkcom
  224.     bra.L    mt_endr
  225.  
  226. mt_arpeggio:
  227.     moveq    #0,d0
  228.     move.b    mt_counter(a4),d0
  229.     divs    #$3,d0
  230.     swap    d0
  231.     tst.w    d0
  232.     beq.s    mt_arp2
  233.     cmp.w    #$2,d0
  234.     beq.s    mt_arp1
  235.  
  236.     moveq    #0,d0
  237.     move.b    $3(a6),d0
  238.     lsr.b    #4,d0
  239.     bra.s    mt_arp3
  240. mt_arp1:moveq    #0,d0
  241.     move.b    $3(a6),d0
  242.     and.b    #$f,d0
  243.     bra.s    mt_arp3
  244. mt_arp2:move.w    $10(a6),d2
  245.     bra.s    mt_arp4
  246. mt_arp3:add.w    d0,d0
  247.     moveq    #0,d1
  248.     move.w    $10(a6),d1
  249.     lea    mt_periods(pc),a0
  250.     moveq    #$24,d7
  251. mt_arploop:
  252.     move.w    (a0,d0.w),d2
  253.     cmp.w    (a0),d1
  254.     bge.s    mt_arp4
  255.     addq.l    #2,a0
  256.     dbf    d7,mt_arploop
  257.     rts
  258. mt_arp4:move.w    d2,$6(a5)
  259.     rts
  260.  
  261. mt_getnew:
  262.     move.l    mt_song(a4),a0
  263.     move.l    a0,a3
  264.     move.l    a0,a2
  265.     add.l    #$c,a3
  266.     add.l    #$3b8,a2
  267.     add.l    #$43c,a0
  268.  
  269.     moveq    #0,d0
  270.     move.l    d0,d1
  271.     move.b    mt_songpos(a4),d0
  272.     move.b    (a2,d0.w),d1
  273.     asl.l    #8,d1
  274.     asl.l    #2,d1
  275.     add.w    mt_pattpos(a4),d1
  276.     clr.w    mt_dmacon(a4)
  277.  
  278.     lea    $dff0a0,a5
  279.     lea    mt_voice1(a4),a6
  280.     bsr.s    mt_playvoice
  281.     lea    $dff0b0,a5
  282.     lea    mt_voice2(a4),a6
  283.     bsr.s    mt_playvoice
  284.     lea    $dff0c0,a5
  285.     lea    mt_voice3(a4),a6
  286.     bsr.s    mt_playvoice
  287.     lea    $dff0d0,a5
  288.     lea    mt_voice4(a4),a6
  289.     bsr.s    mt_playvoice
  290.     bra.L    mt_setdma
  291.  
  292. mt_playvoice:
  293.     move.l    (a0,d1.l),(a6)
  294.     addq.l    #4,d1
  295.     moveq    #0,d2
  296.     move.b    $2(a6),d2
  297.     and.b    #$f0,d2
  298.     lsr.b    #4,d2
  299.     move.b    (a6),d0
  300.     and.b    #$f0,d0
  301.     or.b    d0,d2        ; had a tst.b d2 following
  302.     beq.s    mt_setregs
  303.     moveq    #0,d3
  304.     lea    mt_samplestarts(a4),a1
  305.     move.l    d2,d4
  306.     subq.l    #$1,d2
  307.     asl.l    #2,d2
  308.     mulu    #$1e,d4
  309.     move.l    (a1,d2.l),$4(a6)
  310.     move.w    (a3,d4.l),$8(a6)
  311.     move.w    $2(a3,d4.l),$12(a6)
  312.     move.w    $4(a3,d4.l),d3    ; had a tst.w d3 following
  313.     beq.s    mt_noloop
  314.     move.l    $4(a6),d2
  315.     add.w    d3,d3
  316.     add.l    d3,d2
  317.     move.l    d2,$a(a6)
  318.     move.w    $4(a3,d4.l),d0
  319.     add.w    $6(a3,d4.l),d0
  320.     move.w    d0,8(a6)
  321.     move.w    $6(a3,d4.l),$e(a6)
  322.     move.w    $12(a6),$8(a5)
  323.     bra.s    mt_setregs
  324. mt_noloop:
  325.     move.l    $4(a6),d2
  326.     add.l    d3,d2
  327.     move.l    d2,$a(a6)
  328.     move.w    $6(a3,d4.l),$e(a6)
  329.     move.w    $12(a6),$8(a5)
  330. mt_setregs:
  331.     move.w    (a6),d0
  332.     and.w    #$fff,d0
  333.     beq.L    mt_checkcom2
  334.     move.b    $2(a6),d0
  335.     and.b    #$F,d0
  336.     cmp.b    #$3,d0
  337.     bne.s    mt_setperiod
  338.     bsr.L    mt_setmyport
  339.     bra.L    mt_checkcom2
  340. mt_setperiod:
  341.     move.w    (a6),$10(a6)
  342.     and.w    #$fff,$10(a6)
  343.     move.w    $14(a6),d0
  344. ;    move.w    d0,$dff096        ; nonsense
  345.     clr.b    $1b(a6)
  346.  
  347.     move.l    $4(a6),(a5)
  348.     move.w    $8(a6),$4(a5)
  349.     move.w    $10(a6),d0
  350.     and.w    #$fff,d0
  351.     move.w    d0,$6(a5)
  352.     move.w    $14(a6),d0
  353.     or.w    d0,mt_dmacon(a4)
  354.     bra.L    mt_checkcom2
  355.  
  356. mt_setdma:
  357.     move.w    mt_dmacon(a4),$dff096    ;
  358.     or.b    #1,$bfde00        ; start ciab timerA
  359.     rts
  360.  
  361. timerl6handler:                    
  362.     move.w    #$0f0f,$dff180            ;@color
  363.     movem.l    d0-d7/a0-a6,-(a7)        ; all registers...
  364.     move.l    timer_iv_data(pc),a4        ; well ahem...
  365.     bsr.s    mt_waitcont            ; do delayed routine
  366.     tst.b    $bfdd00                ; clr cia int req
  367.     move.w    #$2000,$dff09c            ; clr int req
  368.     movem.l    (a7)+,d0-d7/a0-a6        ;
  369.     move.w    #$0000,$dff180            ;@color
  370.     rte                    ;
  371.  
  372. mt_waitcont:
  373.     move.w    mt_dmacon(a4),d0
  374.     or.w    #$8000,d0
  375.     move.w    d0,$dff096
  376.  
  377.     lea    $dff0d0,a2
  378.     lea    mt_voice4(a4),a6
  379.     moveq    #$10,d2
  380.     moveq    #1,d1
  381.     moveq    #3,d0
  382. mt_voiceloop:
  383.     move.l    10(a6),(a2);            $dff0d0
  384.     cmp.w    14(a6),d1
  385.     bne.s    mt_nextvoice
  386.     move.w    d1,4(a2);            $dff0d4 ,len
  387. mt_nextvoice:
  388.     sub.w    #mt_voice2-mt_voice1,a6
  389.     sub.l    d2,a2;                #$10
  390.     dbf    d0,mt_voiceloop
  391.  
  392.     add.w    #$10,mt_pattpos(a4)
  393.     cmp.w    #$400,mt_pattpos(a4)
  394.     bne.s    mt_endr
  395. mt_nex:    clr.w    mt_pattpos(a4)
  396.     clr.b    mt_break(a4)
  397.     addq.b    #1,mt_songpos(a4)
  398.     and.b    #$7f,mt_songpos(a4)
  399.     move.b    mt_songpos(a4),d1
  400.     move.l    mt_song(a4),a1
  401.     cmp.b    $3b6(a1),d1
  402.     bne.s    mt_endr
  403.     clr.b    mt_songpos(a4)
  404. mt_endr:tst.b    mt_break(a4)
  405.     bne.s    mt_nex
  406.     rts
  407.  
  408. mt_setmyport:
  409.     move.w    (a6),d2
  410.     and.w    #$fff,d2
  411.     move.w    d2,$18(a6)
  412.     move.w    $10(a6),d0
  413.     clr.b    $16(a6)
  414.     cmp.w    d0,d2
  415.     beq.s    mt_clrport
  416.     bge.s    mt_rt
  417.     move.b    #$1,$16(a6)
  418.     rts
  419. mt_clrport:
  420.     clr.w    $18(a6)
  421. mt_rt:    rts
  422.  
  423. mt_myport:
  424.     move.b    $3(a6),d0
  425.     beq.s    mt_myslide
  426.     move.b    d0,$17(a6)
  427.     clr.b    $3(a6)
  428. mt_myslide:
  429.     tst.w    $18(a6)
  430.     beq.s    mt_rt
  431.     moveq    #0,d0
  432.     move.b    $17(a6),d0
  433.     tst.b    $16(a6)
  434.     bne.s    mt_mysub
  435.     add.w    d0,$10(a6)
  436.     move.w    $18(a6),d0
  437.     cmp.w    $10(a6),d0
  438.     bgt.s    mt_myok
  439.     move.w    $18(a6),$10(a6)
  440.     clr.w    $18(a6)
  441. mt_myok:move.w    $10(a6),$6(a5)
  442.     rts
  443. mt_mysub:
  444.     sub.w    d0,$10(a6)
  445.     move.w    $18(a6),d0
  446.     cmp.w    $10(a6),d0
  447.     blt.s    mt_myok
  448.     move.w    $18(a6),$10(a6)
  449.     clr.w    $18(a6)
  450.     move.w    $10(a6),$6(a5)
  451.     rts
  452.  
  453. mt_vib:    move.b    $3(a6),d0
  454.     beq.s    mt_vi
  455.     move.b    d0,$1a(a6)
  456.  
  457. mt_vi:    move.b    $1b(a6),d0
  458.     lea    mt_sin(pc),a1        ; was a4
  459.     lsr.w    #$2,d0
  460.     and.w    #$1f,d0
  461.     moveq    #0,d2
  462.     move.b    (a1,d0.w),d2        ; was a4
  463.     move.b    $1a(a6),d0
  464.     and.w    #$f,d0
  465.     mulu    d0,d2
  466.     lsr.w    #$6,d2
  467.     move.w    $10(a6),d0
  468.     tst.b    $1b(a6)
  469.     bmi.s    mt_vibmin
  470.     add.w    d2,d0
  471.     bra.s    mt_vib2
  472. mt_vibmin:
  473.     sub.w    d2,d0
  474. mt_vib2:move.w    d0,$6(a5)
  475.     move.b    $1a(a6),d0
  476.     lsr.w    #$2,d0
  477.     and.w    #$3c,d0
  478.     add.b    d0,$1b(a6)
  479.     rts
  480.  
  481. mt_nop:    move.w    $10(a6),$6(a5)
  482.     rts
  483.  
  484. mt_checkcom:
  485.     move.w    $2(a6),d0
  486.     and.w    #$fff,d0
  487.     beq.s    mt_nop
  488.     move.b    $2(a6),d0
  489.     and.b    #$f,d0        ; had a tst.b d0 following
  490.     beq.L    mt_arpeggio
  491.     cmp.b    #$1,d0
  492.     beq.s    mt_portup
  493.     cmp.b    #$2,d0
  494.     beq.L    mt_portdown
  495.     cmp.b    #$3,d0
  496.     beq.L    mt_myport
  497.     cmp.b    #$4,d0
  498.     beq.L    mt_vib
  499.     move.w    $10(a6),$6(a5)
  500.     cmp.b    #$a,d0
  501.     beq.s    mt_volslide
  502.     rts
  503.  
  504. mt_volslide:
  505.     moveq    #0,d0
  506.     move.b    $3(a6),d0
  507.     lsr.b    #4,d0        ; had a tst.b d0 following
  508.     beq.s    mt_voldown
  509.     add.w    d0,$12(a6)
  510.     cmp.w    #$40,$12(a6)
  511.     bmi.s    mt_vol2
  512.     move.w    #$40,$12(a6)
  513. mt_vol2:move.w    $12(a6),$8(a5)
  514.     rts
  515.  
  516. mt_voldown:
  517.     moveq    #0,d0
  518.     move.b    $3(a6),d0
  519.     and.b    #$f,d0
  520.     sub.w    d0,$12(a6)
  521.     bpl.s    mt_vol3
  522.     clr.w    $12(a6)
  523. mt_vol3:move.w    $12(a6),$8(a5)
  524.     rts
  525.  
  526. mt_portup:
  527.     moveq    #0,d0
  528.     move.b    $3(a6),d0
  529.     sub.w    d0,$10(a6)
  530.     move.w    $10(a6),d0
  531.     and.w    #$fff,d0
  532.     cmp.w    #$71,d0
  533.     bpl.s    mt_por2
  534.     and.w    #$f000,$10(a6)
  535.     or.w    #$71,$10(a6)
  536. mt_por2:move.w    $10(a6),d0
  537.     and.w    #$fff,d0
  538.     move.w    d0,$6(a5)
  539.     rts
  540.  
  541. mt_portdown:
  542.     clr.w    d0
  543.     move.b    $3(a6),d0
  544.     add.w    d0,$10(a6)
  545.     move.w    $10(a6),d0
  546.     and.w    #$fff,d0
  547.     cmp.w    #$358,d0
  548.     bmi.s    mt_por3
  549.     and.w    #$f000,$10(a6)
  550.     or.w    #$358,$10(a6)
  551. mt_por3:move.w    $10(a6),d0
  552.     and.w    #$fff,d0
  553.     move.w    d0,$6(a5)
  554.     rts
  555.  
  556. mt_checkcom2:
  557.     move.b    $2(a6),d0
  558.     and.b    #$f,d0
  559.     cmp.b    #$e,d0
  560.     beq.s    mt_setfilt
  561.     cmp.b    #$d,d0
  562.     beq.s    mt_pattbreak
  563.     cmp.b    #$b,d0
  564.     beq.s    mt_posjmp
  565.     cmp.b    #$c,d0
  566.     beq.s    mt_setvol
  567.     cmp.b    #$f,d0
  568.     beq.s    mt_setspeed
  569.     rts
  570.  
  571. mt_setfilt:
  572.     move.b    $3(a6),d0
  573.     and.b    #$1,d0
  574.     beq.s    mt_filtoff
  575.     or.b    #2,$bfe001
  576.     rts
  577. mt_filtoff:
  578.     and.b    #$fd,$bfe001
  579.     rts
  580.  
  581. mt_pattbreak:
  582.     not.b    mt_break(a4)
  583.     rts
  584. mt_posjmp:
  585.     move.b    $3(a6),d0
  586.     subq.b    #$1,d0
  587.     move.b    d0,mt_songpos(a4)
  588.     not.b    mt_break(a4)
  589.     rts
  590. mt_setvol:
  591.     cmp.b    #$40,$3(a6)
  592.     ble.s    mt_vol4
  593.     move.b    #$40,$3(a6)
  594. mt_vol4:moveq    #0,d0
  595.     move.b    $3(a6),d0
  596.     move.w    d0,$8(a5)    ; was move.b
  597.     rts
  598. mt_setspeed:
  599.     move.b    $3(a6),d0
  600.     and.w    #$1f,d0
  601.     beq.s    mt_rts2
  602.     clr.b    mt_counter(a4)
  603.     move.b    d0,mt_speed(a4)
  604. mt_rts2:rts
  605.  
  606. mt_sin:
  607. dc.b $00,$18,$31,$4a,$61,$78,$8d,$a1,$b4,$c5,$d4,$e0,$eb,$f4,$fa,$fd
  608. dc.b $ff,$fd,$fa,$f4,$eb,$e0,$d4,$c5,$b4,$a1,$8d,$78,$61,$4a,$31,$18
  609.  
  610. mt_periods:
  611. dc.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c,$023a,$021a,$01fc,$01e0
  612. dc.w $01c5,$01ac,$0194,$017d,$0168,$0153,$0140,$012e,$011d,$010d,$00fe
  613. dc.w $00f0,$00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097,$008f,$0087
  614. dc.w $007f,$0078,$0071,$0000,$0000
  615.  
  616. mt_song:    equ    4
  617. mt_speed:    equ    8
  618. mt_songpos:    equ    9
  619. mt_pattpos:    equ    10
  620. mt_counter:    equ    12
  621.  
  622. mt_break:    equ    13
  623. mt_dmacon:    equ    14
  624. mt_samplestarts:equ    16    ; len = 124
  625. mt_voice1:    equ    140    ; len = 28
  626. mt_voice2:    equ    168
  627. mt_voice3:    equ    196
  628. mt_voice4:    equ    224
  629. mt_enddata:    equ    252
  630.  
  631. ;---------------------------   END OF MTP   ------------------------------
  632.  
  633.  
  634. ;***   This part belongs to the exampleplayer and can be removed
  635. ;***   if not used. The space must then be ALLOCATEd
  636.  
  637. mt_initdata:
  638.     dc.l    0
  639.     dc.l    0
  640.     dc.b    $6
  641.     dc.b    $0
  642.     dc.w    $0
  643.     dc.b    $0
  644.  
  645.     dc.b    $0
  646.     dc.w    $0
  647.     blk.l    $1f,0
  648.     blk.w    10,0
  649.     dc.w    $1
  650.     blk.w    3,0
  651.     blk.w    10,0
  652.     dc.w    $2
  653.     blk.w    3,0
  654.     blk.w    10,0
  655.     dc.w    $4
  656.     blk.w    3,0
  657.     blk.w    10,0
  658.     dc.w    $8
  659.     blk.w    3,0
  660.